package com.okwanshiwu.payment.aliUtil;/**
 * Created by Administrator on 2017/8/2.
 */

import com.okwanshiwu.payment.wxUtil.WxProperties;
import org.apache.log4j.Logger;

import java.io.InputStream;
import java.util.Properties;

/**
 * 支付宝支付参数实体类
 *
 * @author
 * @create 2017-08-02 11:53
 **/
public class AliProperties {

	private static Logger logger = Logger.getLogger(AliProperties.class);

	//支付宝回调地址
	public static String ALIPAY_NOTIFY;
	// 商户PID
	public static String PARTNER;
	// 商户收款账号
	public static String SELLER;
	// 商户私钥
	public static String RSA_PRIVATEOWN;
	//阿里公钥
	public static String ALI_PUBLIC_KEY;

	String subject;
	String body;
	Integer price;
	String orderId;

	//读取配置文件，初始化一部分参数
	static {
		try{
			InputStream is = WxProperties.class.getResourceAsStream("/common.properties");
			Properties properties = new Properties();
			properties.load(is);
			PARTNER = properties.getProperty("partner");
			SELLER = properties.getProperty("seller");
			ALIPAY_NOTIFY = properties.getProperty("alipay_notify");
			RSA_PRIVATEOWN = properties.getProperty("rsa_privateown");
			ALI_PUBLIC_KEY = properties.getProperty("ali_public_key");
		}catch(Exception ex){
			logger.debug("加载配置文件："+ex.getMessage());
		}
	}

	public AliProperties() {
	}

	public AliProperties(String subject, String body, Integer price, String orderId) {
		this.subject = subject;
		this.body = body;
		this.price = price;
		this.orderId = orderId;
	}

	public String getSubject() {
		return subject;
	}

	public String getBody() {
		return body;
	}

	public Integer getPrice() {
		return price;
	}

	public String getOrderId() {
		return orderId;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public void setBody(String body) {
		this.body = body;
	}

	public void setPrice(Integer price) {
		this.price = price;
	}

	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}
}
